package com.help10000.rms.ui.activitys

import android.content.Intent
import android.os.Bundle
import com.amir.common.mvp.presenter.IPresenter
import com.amir.common.mvp.view.IView
import com.amir.common.utils.Constant
import com.amir.common.utils.SPUtils
import com.help10000.rms.R
import com.help10000.rms.common.PushExtraHelper
import com.help10000.rms.ui.activitys.logins.LoginActivity
import com.help10000.rms.ui.base.BaseActivity
import com.help10000.rms.ui.dialog.PrivacyRemainderDialog
import com.lxj.xpopup.XPopup

class SplashActivity : BaseActivity<IPresenter<IView>, IView>() {

    override fun getlayoutId(): Int {
        return R.layout.activity_splash
    }

    override fun initView() {
    }

    override fun initData(savedInstanceState: Bundle?) {
        SPUtils.instance(this)  // 传入Context初始化
        var readPrivacy = SPUtils.getBoolean("read_privacy")
        var readSplash = SPUtils.getBoolean(Constant.read_splash)
        if (!readSplash) {
            XPopup.Builder(this)
                .dismissOnBackPressed(false)
                .dismissOnTouchOutside(false)
                .asCustom(PrivacyRemainderDialog(this, application))
                .show()

        } else {
            var intent = Intent(this, LoginActivity::class.java);
            PushExtraHelper.handlePushIntent(getIntent(), intent)
            startActivity(intent)
            finish()
        }
    }

}